package com.xb.utils;
/**
 * @class Testsss
 * @description TODO
 * @author zch
 * @date 2019/11/6
 * @version V0.0.1.201911061417.01
 * @modfiyDate 201911061417
 * @createDate 201911061417
 * @package com.xb.utils
 */
import java.util.Arrays;
import java.util.List;
import java.util.function.Consumer;
public class test1 {
	public static void printValur(String str) {
		System.out.println("print value : " + str);
	}
	public static void main(String[] args) {
		System.out.println("----------------普通的写法-----------------------");
		List<String> al = Arrays.asList("a", "b", "c", "d");
		for (String a : al) {
			test1.printValur(a);
		}
		System.out.println("----------------JDK双冒号--------------------------");
		//JDK8中有双冒号的用法，就是把方法当做参数传到stream内部，使stream的每个元素都传入到该方法里面执行一下
		Consumer<String> stringConsumer = test1::printValur;
		System.out.println("----------------方式1--------------------------");
		al.forEach(stringConsumer);
		System.out.println("----------------方式3--------------------------");
		al.forEach(test1::printValur);
	}
}
